package cc.rengu.redp.bizimpl.csmc.controller;


import cc.rengu.redp.bizimpl.csmc.domain.CClearPlan;
import cc.rengu.redp.bizimpl.csmc.service.ICClearPlanService;
import cc.rengu.redp.bizimpl.csmc.vo.CAcctEntryVO;
import cc.rengu.redp.bizimpl.csmc.vo.ClearPlanVO;
import cc.rengu.redp.common.annotation.Log;
import cc.rengu.redp.common.controller.BaseController;
import cc.rengu.redp.common.domain.QueryRequest;
import cc.rengu.redp.common.exception.RedpException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author lizk
 */
@RestController
@Slf4j
@RequestMapping("/admin/csmc/clearPlan")
public class CClearPlanController extends BaseController {

    @Autowired
    private ICClearPlanService clearPlanService;

    @GetMapping
    public Map<String, Object> findByPage(QueryRequest queryRequest, CClearPlan clearPlan) {
        return getDataTable(clearPlanService.findByPage(queryRequest, clearPlan));
    }


    @Log("新增/修改/停用/启用 清分清算方案资金配置")
    @PostMapping
//    @RequiresPermissions("brand:add")
    public void oprClearPlan(@RequestBody ClearPlanVO clearPlanVO) throws RedpException {

        try {
            this.clearPlanService.oprClearPlan(clearPlanVO);
        } catch (Exception e) {
            String message = e.getMessage();
            log.error(message, e);
            throw new RedpException(message);
        }

    }





}
